{% extends "base_generic.html" %}

{% block content %}
    <h1>Book List</h1>
    {% if book_list %}
        <ul>
            {% for book in book_list %}
                <li>
                    <a href="{{ book.get_absolute_url }}">{{ book.title }}</a> ({{ book.author }})
                    {% if perms.catalog.can_mark_returned %}
                        - <a href="{% url 'book-update' book.pk %}">update</a> -
                        <a href="{% url 'book-delete' book.pk %}">delete</a>
                    {% endif %}
                </li>
            {% endfor %}
        </ul>
    {% else %}
        <p>There are no books in the library.</p>
    {% endif %}
    {% if perms.catalog.can_mark_returned %}
        <a href="{% url 'book-create' %}">Add a book</a>
    {% endif %}
{% endblock %}